<template>
	<!-- 新用户福利 -->
	<view class="newPeople pf">
		<view class="card_box pr">
			<view class="card pa">
				<view class="x-c" v-for="(item,index) in newCoupons" :key="index">
					<view class="cardBg  pr">
						<image class="moneyimg pa" src="/static/image/newMoney.png" mode=""></image>
						<view class="cardText">
							<view class="name">{{item.name}}</view>
							<view class="date">有效期：{{item.use_start_time}}~{{item.use_end_time}}</view>
							<view class="score"><span>{{item.points}}</span>积分</view>
							<view class="sumbitUse tc pa" @click="getNow(item, index)" v-if="item.type == 0">立即领取</view>
							<view class="sumbitUse tc pa" v-if="item.type == 1"
								:class="item.type == 1 ? 'get' : '' ">立即领取</view>
						</view>
					</view>
				</view>
			</view>
			<view class="closeCard pa" @click="closeBtn">
				<image src="/static/image/close.png"></image>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				img: this.imgUrl + 'newCard.png',
			}
		},
		props: {
			newCoupons: {
				type: Array,
				default: []
			},
		},
		methods: {
			getNow(item, index) {
				this.$emit('getNow', index);
			},
			closeBtn() {
				this.$emit('closeBtn');
			},
		}
	}
</script>

<style lang="scss" scoped>
	// 新用户福利
	.newPeople {
		width: 100%;
		height: 100%;
		top: 0;
		bottom: 0;
		right: 0;
		left: 0;
		z-index: 99;
		background-color: rgba(#000, 0.7);

		.card_box {
			z-index: 999;
			top: 17%;
			left: 2%;
			background: url(https://mystore-1304299581.cos.ap-guangzhou.myqcloud.com/static/image/newCard.png) no-repeat;
			background-size: 100% 100%;
			width: 700rpx;
			height: 864rpx;
		}

		.card {
			top: 42%;
			left: 18%;

			.cardBg {
				background: url(/static/image/newbg.png) no-repeat;
				width: 478rpx;
				height: 136rpx;
				background-size: 100% 100%;
				margin-bottom: 20rpx;

				.moneyimg {
					left: 0;
					top: 0;
					width: 140rpx;
					height: 137rpx;
				}

				.cardText {
					padding: 10rpx 0 0 160rpx;

					.name {
						text-align: left;
						color: #333;
						font-size: 26rpx;
						font-weight: 700;
					}

					.date {
						text-align: left;
						color: #999;
						font-size: 20rpx;
					}

					.score {
						padding-top: 5rpx;
						text-align: left;
						font-size: 28rpx;
						color: #e93323;

						span {
							font-size: 36rpx;
							font-weight: 600;
						}
					}

					.sumbitUse {
						right: 15rpx;
						bottom: 15rpx;
						width: 122rpx;
						background: linear-gradient(90deg, #ff2d1b 8%, #ff977b 96%);
						border-radius: 22rpx;
						color: #fff;
						font-size: 22rpx;
						line-height: 40rpx;
					}

					.get {
						background: linear-gradient(to right, #CFCFCF, #EBEBEB);
					}
				}
			}
		}

		.closeCard {
			bottom: -70px;
			left: 322rpx;
			margin-top: 80rpx;

			image {
				width: 56rpx;
				height: 56rpx;
			}
		}
	}
</style>
